@extends('backend::layout')

@section('title', '添加学生信息')

@section('content')
    <form method="post">
        {{ csrf_field() }}
        <div class="box box-primary">
            <div class="box-header with-border">
                <div class="col-lg-4">
                    <h3 class="box-title">添加学生信息</h3>
                </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body pad-10">
                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('c_code')) has-error @endif">
                        <label class="control-label">班级</label>
                        <select class="form-control" id="agency" name="c_code">
                            <option  value="">--班级--</option>
                            @foreach($classes as $val)
                                <option value="{{ $val->c_code }}" @if(old('c_code') == $val->c_code || (old('c_code') === null && (isset($query['c_code']) && $query['c_code'] ==  $val->c_code )) ) selected @endif >{{ $val->name }}</option>
                            @endforeach
                        </select>
                        @if($errors->has('c_code'))
                            <span class="help-block">{{ $errors->first('c_code') }}</span>
                        @endif
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('s_code')) has-error @endif">
                        <label class="control-label">{{ __("code") }}</label>
                        <input class="form-control " name="s_code" type="text" placeholder="{{ __("code") }}" value="{{ old('s_code') }}">
                        @if($errors->has('s_code'))
                            <span class="help-block">{{ $errors->first('s_code') }}</span>
                        @endif
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('name')) has-error @endif">
                        <label class="control-label">{{ __("Username") }}</label>
                        <input class="form-control " name="name" type="text" placeholder="{{ __("Username") }}" value="{{ old('name') }}">
                        @if($errors->has('name'))
                            <span class="help-block">{{ $errors->first('name') }}</span>
                        @endif
                    </div>
                </div>
{{--                <div class="col-lg-4">--}}
{{--                    <div class="form-group">--}}
{{--                        <label class="control-label">{{ __('Sex') }}</label>--}}
{{--                        <div class="radio">--}}
{{--                            <label>--}}
{{--                                <input type="radio" value="1" @if(old('sex') === null || old('sex') == 1) checked @endif name="sex">--}}
{{--                                {{ __('Male') }}--}}
{{--                            </label>--}}
{{--                        </div>--}}
{{--                        <div class="radio">--}}
{{--                            <label>--}}
{{--                                <input type="radio" value="0" @if(old('sex') !== null && old('sex') == 0) checked @endif name="sex">--}}
{{--                                {{ __('Female') }}--}}
{{--                            </label>--}}
{{--                        </div>--}}
{{--                        @if($errors->has('sex'))--}}
{{--                            <span class="help-block text-danger">{{ $errors->first('sex') }}</span>--}}
{{--                        @endif--}}
{{--                    </div>--}}
{{--                </div>--}}
{{--                <div class="col-lg-4">--}}
{{--                    <div class="form-group @if($errors->has('birthday')) has-error @endif">--}}
{{--                        <label class="control-label">生日</label>--}}
{{--                        <div class="input-group date form_date" data-date="" data-date-format="yyyy-mm-dd HH:ii:ss" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd HH:ii:ss">--}}
{{--                            <input class="form-control" size="16" type="text" name="birthday" value="{{ old('birthday') }}" readonly>--}}
{{--                            <span class="input-group-addon"><span class="fa fa-lg fa-calendar"></span></span>--}}
{{--                        </div>--}}
{{--                        @if($errors->has('birthday'))--}}
{{--                            <span class="help-block">{{ $errors->first('birthday') }}</span>--}}
{{--                        @endif--}}
{{--                    </div>--}}
{{--                </div>--}}
            </div>

            <!-- /.box-body -->
            <div class="box-footer m-b-2">
                <div class="col-lg-4">
                    <button class="btn btn-primary btn-sm" type="submit">
                        <i class="fa fa-check"></i> {{ __('Save') }}
                    </button>
                    &nbsp;&nbsp;&nbsp;
                    <a class="btn btn-default btn-sm" href="{{ route('admin.student.index') }}">
                        <i class="fa fa-undo"></i> {{ __('Back') }}
                    </a>
                </div>
            </div>
            <!-- /.box-footer -->
        </div>
    </form>
@stop

@section('script')
    <script>
        !function ($) {
            $(function () {
                $('.form_date').datetimepicker({
                    language:  'zh-CN',
                    weekStart: 1,
                    todayBtn:  1,
                    autoclose: 1,
                    todayHighlight: 1,
                    startView: 2,
                    minView: 2,
                    forceParse: 0
                });
            });
        }(jQuery);

    </script>
@stop